package com.itheima.zixi1;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class datatest {
    public static void main(String[] args) throws ParseException {
        Date d = new Date();
        System.out.println(d);
        Long time = d.getTime();
        Date d1 = new Date(time);
        System.out.println(d1);
        time = time + 2*1000 ;
        System.out.println(time);
        Date d2 = new Date(time);
        System.out.println(d2);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");


        String format = sdf.format(d);
        System.out.println(format);
        String S = "2020-05-05 09:09:09";
        Date parse = sdf.parse(S);
        System.out.println(parse);


    }
}
